package com.letoy.edu.controller;

import com.letoy.edu.entity.MajorInfo;
import com.letoy.edu.entity.ScoreInfo;
import com.letoy.edu.service.ScoreInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Api(value = "分数信息管理", tags = "分数信息API")
public class ScoreInfoController {


    @Autowired
    ScoreInfoService scoreInfoService;

    @PostMapping("/score/getAllScoreInfo")
    @ApiOperation(value = "分数表查询所有", notes = "分数表查询所有")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> getAllScoreInfo() {
        return scoreInfoService.getAllScoreInfo();
    }

    @PostMapping("/score/getScoreInfoByScoreId")
    @ApiOperation(value = "分数表根据分数ID查询", notes = "分数表根据分数ID查询")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> getScoreInfoByScoreId(int scoreId) {
        return scoreInfoService.getScoreInfoByScoreId(scoreId);
    }

    @PostMapping("/score/insertScoreInfo")
    @ApiOperation(value = "分数表插入分数信息", notes = "分数表插入分数信息")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> insertScoreInfo(ScoreInfo scoreInfo) {
        return scoreInfoService.insertScoreInfo(scoreInfo);
    }

    @PostMapping("/score/updateScoreInfo")
    @ApiOperation(value = "分数表更新分数", notes = "分数表更新分数")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> updateScoreInfo(ScoreInfo scoreInfo) {
        return scoreInfoService.updateScoreInfo(scoreInfo);
    }

    @PostMapping("/score/deleteMajorInfo")
    @ApiOperation(value = "分数表删除分数", notes = "分数表删除分数")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> deleteMajorInfo(int scoreId) {
        return scoreInfoService.deleteScoreInfo(scoreId);
    }
}
